package pers.echo.tester.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import pers.echo.tester.entity.TblLandinfo;
import pers.echo.tester.enums.ResTypeEnum;
import pers.echo.tester.mapper.TblLandinfoMapper;
import pers.echo.tester.service.ITblLandinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * ????? 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2020-09-17
 */
@Service
public class TblLandinfoServiceImpl extends ServiceImpl<TblLandinfoMapper, TblLandinfo> implements ITblLandinfoService {

    @Autowired(required = false)
    TblLandinfoMapper mapper;

    @Override
    public TblLandinfo getTblLandinfoTemplate() {

        TblLandinfo landinfo = mapper.getFirstLandinfo();
        if(landinfo!=null){
            landinfo.setBulletinid(null);
            landinfo.setFNo(null);
            landinfo.setLandinfoid(null);

            LocalDateTime beginTime = LocalDateTime.now();
            LocalDateTime bailTime = beginTime.plusDays(10);
            LocalDateTime startTime = beginTime.plusDays(20);
            LocalDateTime closeTime = beginTime.plusDays(30);

            landinfo.setFBeigintime(startTime);
            landinfo.setFClosetime(closeTime);
            landinfo.setFFinishtime(closeTime);
            landinfo.setLastfixtime(beginTime);
            landinfo.setCreatedtime(beginTime);
            landinfo.setFBailtime(bailTime);

            landinfo.setFStatuscode("K");
            return landinfo;
        }
        return null;
    }
}
